var mobId, mob, stats, modified, MaxRandom, setupTask, ostats, victor, luck;
var 复活次数 = 11;
var 副本名称 = "觉醒希拉[剧情]";
var 实例地图 = [450010600, 450010700, 993063037, 993063038, 993063041, 450010800];
var 准备地图 = 450011990;
var 动画 = false;

function init() {}

function setup(e, a) {
    em.setProperty("state", "1");
    em.setProperty("leader", "true");
    for (var c = 0; c < 实例地图.length; c++) {
        var b = em.newInstance(副本名称);
        var d = b.setInstanceMap(实例地图[c]);
        d.resetPQ(e);
        d.resetFully();
        d.killAllMonsters(true)
    }
    b.startEventTimer(1000 * 60 * 20);
    b.schedule("summon", 2000);
    b.setProperty("logg", "0");
    return b
}

function onPlayerRegistered(b, a) {
    var c = b.getMapInstance(实例地图[动画 ? 0 : 1]);
    a.changeMap(c, c.getPortal(0));
    a.setReviveCount(复活次数)
}

function onPlayerRevived(b, a) {
    if (a.getReviveCount() > 0) {
        var c = a.getMap();
        a.eventRevive(c, c.getPortal(0));
        return true
    }
    var c = b.getMapFactoryMap(准备地图);
    a.changeMap(c, c.getPortal(0));
    return true
}

function onMapChanged(c, b, a) {
    if (实例地图.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
}

function onMonsterKilled(a, c) {
    if (c == 8880415) {
        var b = a.getNumberProperty("logg");
        if (b == 0) {
            a.setProperty("logg", 1);
            player.getAPI().warp(993063037, 0, true)
        } else {
            var d = a.getMapInstance(450010700);
            d.killAllMonsters(true);
            warp(a, 993063039, 0)
        }
    }
}

function summon(c) {
    var d;
    d = c.getMapInstance(450010700);
    var b = em.getMonster(8880435);
    var a = em.getMonster(8880435);
    if (d.getNumMonsters() < 3) {
        d.spawnMonsterOnGroundBelow(b, new java.awt.Point(195, 266));
        d.spawnMonsterOnGroundBelow(a, new java.awt.Point(170, 266))
    }
    if (em.getProperty("state").equals("1")) {
        c.schedule("summon", 6000)
    }
}

function onMonsterDamaged(c, b, g, h, e) {
    if (g == 8880415) {
        var f = b.getAPI().addNumberForQuestInfo(g, "damage", h);
        var d = c.getNumberProperty("logg");
        var a = em.getMonster(g).getMobMaxHp();
        if (f >= a / 2 && d == 0) {
            c.setProperty("logg", 1);
            b.getAPI().warp(993063037, 0, true)
        }
    }
}

function Chuansong(b, a) {
    warp(b, 450005015, 0)
}

function openNpc(c, b, d) {
    for (var a = 0; a < c.getPlayerCount(); a++) {
        c.getPlayers().get(a).getAPI().openNpc(b, d)
    }
}

function warp(d, c, a) {
    for (var b = 0; b < d.getPlayerCount(); b++) {
        d.getPlayers().get(b).getAPI().warp(c, a)
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onPlayerKilled(b, a) {}

function onPartyDisbanded(a) {
    on玩家退场(a, player, false)
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onItemPickedUp(b, a, c) {};